package com.ssy.lingxi.platform.template.service.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.entity.door.MemberChannel;
import com.ssy.lingxi.platform.template.service.model.dto.mobile.MemberChannelMainMobileDTO;
import com.ssy.lingxi.platform.template.service.model.vo.mobile.MemberChannelMainMobileVO;
import com.ssy.lingxi.platform.template.service.model.vo.mobile.MemberChannelUpperMobileVO;
import com.ssy.lingxi.platform.template.service.service.mobile.MemberChannelMobileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @menu mobile - 会员渠道门户
 * @author fhj
 * @version 2.0.0
 * @date 2020/12/30
 */
@Api(tags = "mobile - 会员渠道门户")
@RestController
@RequestMapping("/template/mobile/memberChannelMobile")
public class MemberChannelMobileController extends BaseController {

    @Resource
    private MemberChannelMobileService memberChannelMobileService;

    @ApiOperation(value = "会员渠道主页")
    @GetMapping("/memberChannelMain")
    public Wrapper<MemberChannelMainMobileVO> memberChannelMain(MemberChannelMainMobileDTO dto) {
        return memberChannelMobileService.memberChannelMain(dto);
    }

    @ApiOperation(value = "根据邀请码获取渠道商")
    @GetMapping("/findByInviteCode")
    public Wrapper<MemberChannel> findByInviteCode(String inviteCode) {
        return memberChannelMobileService.findByInviteCode(inviteCode, getSysUser());
    }

    @ApiOperation(value = "获取上级渠道商")
    @GetMapping("/findUpperChannel")
    public Wrapper<List<MemberChannelUpperMobileVO>> findUpperChannel() {
        return memberChannelMobileService.findUpperChannel(getSysUser());
    }
}
